package com.cgtong.android.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;

import com.cgtong.android.R;
import com.cgtong.android.bean.MessageBean;
import com.cgtong.android.http.ConstantManager;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class MessageAdapter extends BaseQuickAdapter<MessageBean, BaseViewHolder> {


    public MessageAdapter(@Nullable List<MessageBean> data) {
        super(R.layout.adapter_my_message, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MessageBean item) {

        helper.setText(R.id.tv_title, item.getTitle());
        helper.setText(R.id.tv_content, item.getContent());
        helper.setText(R.id.tv_date, item.getMsgTime());

        if (item.getReadStatus() == ConstantManager.ReadStatus.REDED) {
            helper.setTextColor(R.id.tv_title, Color.parseColor("#BCBCBC"));
            helper.setTextColor(R.id.tv_content, Color.parseColor("#BCBCBC"));
            helper.setTextColor(R.id.tv_date, Color.parseColor("#BCBCBC"));
            helper.setTextColor(R.id.tv_go, Color.parseColor("#BCBCBC"));
        } else {
            helper.setTextColor(R.id.tv_title, Color.RED);
            helper.setTextColor(R.id.tv_content, Color.RED);
            helper.setTextColor(R.id.tv_date, Color.RED);
            helper.setTextColor(R.id.tv_go, Color.RED);
        }
    }
}
